<!DOCTYPE html>
<html lang="en">
<head>
    <title>微信好友页面</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style type="text/css">
        .table-width {
            width: 610px;
        }

        .title {
            font-size: 20px;
            text-align: center;
            margin-bottom: 8px;
        }

        .row {
            margin-right: -15px;
            margin-left: 0px;
        }

        .col-md-12 {
            padding-left: 0;
        }

        .infoReport {
            text-align: left;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
        .text{
            text-align: center;
        }
    </style>

</head>
<body>
<section v-cloak class="content" id="app" style="min-height:100px;">
    <!--</div>-->
    <div v-if="list.length==0" style="position: absolute;top: 50%;left:40%; font-size: 20px;">
暂无数据
    </div><div id="container" style="width:260px;height:260px"></div>
    <!-- /.box-body -->
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript" src="/dist/plugins/highcharts/highcharts.js"></script>
<script type="text/javascript">
    function getUrlParamObj() {
        var args = new Object();
        var query = location.href;
        var pairs = query.split("&"); //www.cxybl.com break at ampersand
        for (var i = 0; i < pairs.length; i++) {
            var pos = pairs[i].indexOf('='); // look for "name=value"
            if (pos == -1) continue; // if not found, skip
            var argname = pairs[i].substring(0, pos); // extract the name
            var pos1 = argname.indexOf('?');
            if (pos1 > -1) {
                argname = argname.substring(pos1 + 1);
            }
            var value = pairs[i].substring(pos + 1); // extract the value
            value = decodeURIComponent(value); // decode it, if needed
            args[argname] = value; // store as a property
        }
        var ss = args.valueOf(0);
        obj = args;
        return args;
    }
    var app = new Vue({
        el: '#app',
        data: {
            chartList:[],
            list:[],
        },
        mounted: function () {
            var that = this;
            if (getUrlParamObj().id) {
                var data = {
                    userId: getUrlParamObj().id,
                    pageSize:7,
                    requestPage:1
                }
                console.log(JSON.stringify(data))
                $.ajax({
                    url: server.ip + urlConfig.system.wechatShare.getChartByUserId,
                    contentType: 'application/json;charset=utf-8',
                    type: "POST",
                    data: JSON.stringify(data),
                    success: function (r) {
                        var res = JSON.parse(r)
                        console.log(res);
                        console.log(res.data.sendData);
                        var list=res.data.sendData.records;
                        that.list=list
                        var newList=[];
                        var newList1 = [];//下标
                        if(list.length==0){
                            $("#container").hide();
                        }
                        for(var i=0;i<list.length;i++){
                            newList.push(list[i].contacts)
                            newList1.push(i+1)
                        }

                        var chart = Highcharts.chart('container', {
                            title: {
                                text: '微信好友数量图'
                            },
                            yAxis: {
                                title:'',
                            },
                            legend: {
                                enabled: false
                            },
                            xAxis: {
                                categories: newList1,
                                crosshair: true,
                                reversed:true,
                                visible: false

                            },
                            credits: {
                                enabled: false
                            },
                            series: [{
                                name: '好友数量',
                                data: newList
                            }],
                        });
                    },
                    error: function (e) {
                        alert(e.responseText)
                    }
                });
            }

        }

    });
</script>

</body>
</html>